<template>
	<view>
		<view class="" v-show="isLoaded">
			<!-- 头部轮播 -->
			<view class="carousel-section">
				<!-- 标题栏和状态栏占位符 -->
				<view class="navbar">
					<!-- <image :src="userInfo.headimg" alt="" @tap="checkLogin"></image> -->
					<view class="navbar_img">
						<robby-image-upload v-if="cate == 2" :src="userInfo.logo" :width="width" :height="height"
							:lineheight="lineheight" :borderRadius="borderRadius"></robby-image-upload>
						<robby-image-upload v-else :src="userInfo.headimg" :width="width" :height="height"
							:lineheight="lineheight" :borderRadius="borderRadius"></robby-image-upload>
					</view>
					<view class="navbar_text" v-if="hasLogin === true">
						<text class="navbar_text-name">{{userInfo.name}}</text>
						<text class="navbar_text-name" v-if="userInfo.invitation_code">邀请码: {{userInfo.invitation_code}}
							(积分:{{userInfo.invitation_code_balance}})</text>
						<view class="" v-if="cate == 1">
							<view class="navbar_text-level" v-if="userInfo.status === 4">
								<image class="navbar_text-level-img" src="@/static/images/yirenzheng.png"></image>
							</view>
							<view class="navbar_text-level" v-else>
								<image class="navbar_text-level-img" src="@/static/images/weirenzheng.png"
									@tap="authApply"></image>
								<text class="navbar_text-level-text">完成实名认证，信息优先推荐</text>
							</view>
						</view>

						<view class="" v-if="cate == 2">
							<view class="navbar_text-level" v-if="userInfo.status === 3">
								<image class="navbar_text-level-img" src="@/static/images/yirenzheng.png"></image>
							</view>
							<view class="navbar_text-level" v-else>
								<image class="navbar_text-level-img" src="@/static/images/weirenzheng.png"
									@tap="authApply"></image>
								<text class="navbar_text-level-text">完成实名认证，信息优先推荐</text>
							</view>
						</view>

					</view>
					<view class="navbar_text" style="line-height: 96rpx;font-size: 32rpx;" v-else @tap="checkLogin">
						<text class="">登录/注册</text>
					</view>
				</view>
				<view class="navbar_url">
					<!-- #ifndef MP-WEIXIN -->
					<view class="navbar_url_first" @tap="invate">
						<image class="navbar_url_first_img" src="@/static/images/wdeyaoqing.png"></image>
						<text class="navbar_url_first_text">我的邀请</text>
					</view>
					<!-- #endif -->

					<view class="navbar_url_second" @tap="goBroswer">
						<image class="navbar_url_second_img" src="@/static/images/toudijilu.png"></image>
						<text class="navbar_url_second_text">浏览记录</text>
					</view>
					<view class="navbar_url_third" @tap="collect">
						<image class="navbar_url_third_img" src="@/static/images/xiangmujilu.png"></image>
						<text class="navbar_url_third_text" v-show="cate == 1">项目记录</text>
						<text class="navbar_url_third_text" v-show="cate == 2">工程记录</text>
					</view>
				</view>

				<view class="members" v-if="isShowRecharge">
					<view class="members-btn" @tap="goVip">
						立即充值
					</view>
				</view>
			</view>
			<!-- 快捷方式 -->
			<view class="cate-section">
				<view class="cate-section-header">
					<view class="cate-section-header-left">
						<!-- <image class="cate-section-header-left-img" src="@/static/images/zuogang.png"></image> -->
						<text class="cate-section-header-left-text" v-show="cate == 1">我的订单</text>
						<text class="cate-section-header-left-text" v-show="cate == 2">我的发布</text>
					</view>
					<view class="cate-section-header-right" @tap="userOrders(0,'全部')">
						<text class="cate-section-header-right-text">查看全部</text>
						<image class="cate-section-header-right-img" src="@/static/images/chakan-you.png"></image>
					</view>
				</view>
				<view class="cate-section-content">
					<view v-if="cate == 1" class="cate-item" @tap="userOrders(10,'已到岗')">
						<image class="cate-item-img" src="@/static/images/arrived.png"></image>
						<text class="cate-item-text">已到岗</text>
					</view>
					<view v-if="cate == 2" class="cate-item" @tap="userOrders(10,'已发布')">
						<image class="cate-item-img" src="@/static/images/yifabu.png"></image>
						<text class="cate-item-text">已发布</text>
					</view>
					<view class="cate-item" @tap="userOrders(20,'工作中')">
						<image class="cate-item-img" src="@/pages6/static/images/at-work.png"></image>
						<text class="cate-item-text">工作中</text>
					</view>
					<view class="cate-item" @tap="userOrders(30,'已完成')">
						<image class="cate-item-img" src="@/pages6/static/images/completed.png"></image>
						<text class="cate-item-text">已完成</text>
					</view>
					<!-- <view class="cate-item" @tap="userOrders(40,'已结算')">
						<image class="cate-item-img" src="@/static/images/yijiesuan.png"></image>
						<text class="cate-item-text">已结算</text>
					</view> -->
				</view>
			</view>

			<view class="place"></view>

			<!--  -->
			<view class="list">
				<view class="list-header">
					<!-- <image class="list-header-img" src="@/static/images/zuogang.png"></image> -->
					<text class="list-header-text">我的服务</text>
				</view>


				<view class="list-item" @tap="findProject(2,'附近劳务')" v-if="cate != 1">
					<image class="list-item-img" src="@/static/images/fujingongzuo.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">附近劳务</text>
					</view>
				</view>
				<!-- <view class="list-item" @tap="findWorder(3,'最新劳务')" v-if="cate != 1">
					<image class="list-item-img" src="@/static/images/zuixingangwei.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">最新劳务</text>
					</view>
				</view> -->

				<view class="list-item" @tap="authApply" v-if="cate == 2">
					<image class="list-item-img" src="@/static/images/shimingrenzheng.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">实名认证</text>
						<!-- <text class="list-item-text-introduct">信息优先推荐</text> -->
					</view>
				</view>

				<view class="list-item" @tap="goWealth">
					<image class="list-item-img" src="@/static/images/wdegongzi.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">我的财富</text>
					</view>
				</view>
				<view class="list-item" v-if="cate == 2" @tap="goPublish">
					<image class="list-item-img" src="@/pages6/static/images/fabuxiangmu.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">发布项目</text>
						<!-- <text class="list-item-text-introduct">发布项目信息</text> -->
					</view>
				</view>
				<view class="list-item" v-if="cate == 2" @tap="goAppoint">
					<image class="list-item-img" src="@/static/images/wdeyuyue.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">工人预约</text>
						<!-- <text class="list-item-text-introduct">邀请他人</text> -->
					</view>
				</view>
				<view class="list-item" @tap="setInfo" v-if="cate != 1">
					<image class="list-item-img" src="@/static/images/shezhizhongxin.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">设置中心</text>
						<!-- <text class="list-item-text-introduct">修改信息</text> -->
					</view>
				</view>
				<view class="list-item" @tap="findProject(2,'附近工作')" v-if="cate == 1">
					<image class="list-item-img" src="@/static/images/fujingongzuo.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">附近工作</text>
					</view>
				</view>
				<!-- <view class="list-item" v-if="cate == 1" @tap="timeCard">
					<image class="list-item-img" src="@/pages6/static/images/completed.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">考勤管理</text>
					</view>
				</view> -->

				<!-- <view class="cate-item" @tap="findProject(2,'附近工作')" v-if="cate == 1">
					<image class="cate-item-img" src="@/static/images/fujingongzuo.png"></image>
					<text class="cate-item-text">附近工作</text>
				</view> -->

				<!-- <view class="list-item" @tap="authApply">
					<image class="list-item-img" src="@/static/images/shimingrenzheng.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">实名认证</text>
						<text class="list-item-text-introduct">信息优先推荐</text>
					</view>
				</view> -->
				<view class="list-item" @tap="setInfo" v-if="cate==1">
					<image class="list-item-img" src="@/static/images/shezhizhongxin.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">设置中心</text>
						<!-- <text class="list-item-text-introduct">修改信息</text> -->
					</view>
				</view>
				<view class="list-item" v-if="cate == 1" @tap="gomoney">
					<image class="list-item-img" src="@/static/images/wdegongzi.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">我的工资</text>
						<!-- <text class="list-item-text-introduct">查询工资</text> -->
					</view>
				</view>

				<view class="list-item" v-if="cate == 1" @tap="goAppoint">
					<image class="list-item-img" src="@/static/images/wdeyuyue.png"></image>
					<view class="today-num" v-show="userInfo.appoint_num > 0">{{userInfo.appoint_num}}</view>
					<view class="list-item-text">
						<text class="list-item-text-title">我的预约</text>
						<!-- <text class="list-item-text-introduct">邀请他人</text> -->
					</view>
				</view>


				<!-- <view class="list-item">
					<view class="list-item-left" @tap="">
						<image class="list-item-img" src="@/static/images/wdejifen.png"></image>
						<view class="list-item-text">
							<text class="list-item-text-title">我的积分</text>
							<!-- <text class="list-item-text-introduct">专属你的私人客服</text> -->
				<!-- </view>
					</view> -->
				<!-- <view class="list-item-right">
						<image class="list-item-img" src="@/static/images/wdeduihuan.png"></image>
						<view class="list-item-text">
							<text class="list-item-text-title">我的兑换</text> -->
				<!-- <text class="list-item-text-introduct">联系客服 寻求帮助</text> -->
				<!-- </view>
					</view> -->
				<!-- </view> -->
				<view class="list-item" @tap="helpCenter">
					<!-- <view class="list-item-left" @tap="goopinion">
						<image class="list-item-img" src="@/static/images/yijianfankui.png"></image>
						<view class="list-item-text">
							<text class="list-item-text-title">意见反馈</text>
							<!-- <text class="list-item-text-introduct">专属你的私人客服</text> -->
					<!-- </view>
					</view> -->
					<image class="list-item-img" src="@/static/images/yijianfankui.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">帮助中心</text>
						<!-- <text class="list-item-text-introduct">专属你的私人客服</text> -->
					</view>
				</view>
				<view class="list-item" @tap="kefu">
					<image class="list-item-img" src="@/static/images/wdekefu.png"></image>
					<view class="list-item-text">
						<text class="list-item-text-title">我的客服</text>
						<!-- <text class="list-item-text-introduct">联系客服 寻求帮助</text> -->
					</view>
				</view>
			</view>

			<view class="toggle">
				<view class="toggle-info" @tap="confirmToggle">
					{{toggleContent}}
				</view>
			</view>

			<view class="mark1" v-show="isShowKefu">
				<view class="banks-list">
					<image src="@/static/images/guanbi.png"
						style="width:23rpx;height:23rpx;position: absolute;right:50rpx;top:30rpx;" @tap="cancle(1)">
					</image>
					<view class="banks-list1">
						<view class="banks-list1-left">
							<image class="image1" src="/static/images/rengongdianhua.png"
								style="width:63rpx;height:64rpx;"></image>
						</view>
						<view class="banks-list1-center">
							<text class="text1">电话人工客服</text>
							<text class="text2">周一至周五</text>
						</view>
						<view class="banks-list1-right" @tap="callPhone">
							<image class="image2" src="/static/images/zixun.png" style="width:123rpx;height:45rpx;">
							</image>
						</view>
					</view>

				</view>
			</view>

			<view class="mark2" v-show="isShowShare">
				<view class="banks-list">
					<view class="banks-list-title">
						<text>分享</text>
						<image src="@/static/images/guanbi.png"
							style="width:23rpx;height:23rpx;position: absolute;right:50rpx;" @tap="cancle(2)"></image>
					</view>
					<view class="banks-list-content">
						<view class="banks-list1">
							<view class="banks-list1-item" @tap="haoyou">
								<image class="images" src="/static/images/weixin.png"></image>
								<text class="texts">微信好友</text>
							</view>
							<view class="banks-list1-item" @tap="pengyouquan">
								<image class="images" src="/static/images/pengyouquan.png"></image>
								<text class="texts">朋友圈</text>
							</view>
							<view class="banks-list1-item" @tap="copyUrl">
								<image class="images" src="/static/images/fuzhilianjie.png"></image>
								<text class="texts">复制链接</text>
							</view>
						</view>
						<view class="banks-list2">
							<view class="banks-list2-cancle" @tap="cancle(2)">取消</view>
						</view>
					</view>
				</view>
			</view>

			<uni-popup ref="alertDialog1" type="dialog">
				<uni-popup-dialog :type="msgType" title="下载确认" content="" @confirm="dialogConfirm1">
					<view class="remember">
						浏览器暂不支持该功能，请下载app
					</view>
				</uni-popup-dialog>
			</uni-popup>

			<uni-popup ref="alertDialog2" type="dialog">
				<uni-popup-dialog :type="msgType" title="分享确认" content="">
					<view style="font-size: 30rpx;">
						微信内置浏览器暂不支持该功能，若要分享，请点击右上角 <image src="/static/images/tupiansandian.png" alt=""
							style="width:68rpx;height:34rpx;margin:0 10rpx;">选择分享
					</view>
				</uni-popup-dialog>
			</uni-popup>

			<!-- 底部菜单 -->
			<BottomTabbar :selected="3"></BottomTabbar>
		</view>
	</view>
</template>

<script>
	import BottomTabbar from '@/components/bottom-tabbar/bottom-tabbar.vue';
	import robbyImageUpload from '@/components/robby-image-upload/robby-image-upload.vue';
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {

		data() {
			return {
				isLoaded: false,
				empty: true,
				cate: 1,
				height: '109rpx',
				lineheight: '109rpx',
				width: '109rpx',
				borderRadius: '',
				toggleContent: '切换企业版',

				userInfo: {
					name: '佚名',
					headimg: '/static/images/touxiang.png',
					logo: '/static/images/touxiang.png',
					status: 0,
					broswer_num: 0,
					appoint_num: 0,
					wechatid: 0,
				},

				IDcard: {
					ID1: '',
					ID2: '',
				},

				license: '',
				isShowKefu: false,
				isShowShare: false,
				isShowRecharge: true,
				msgType: 'info',

				webUrl: 'https://test.hnliandesy.com/h5/#/'
			};
		},

		computed: {
			...mapState(['hasLogin']),
		},
		components: {
			robbyImageUpload,
			BottomTabbar
		},
		//下拉刷新
		onPullDownRefresh() {
			//判断是否登录
			let result = this.$api.isLogin();
			if (result === false) {
				return false;
			}
			if (this.cate == 2) {
				this.toggleContent = '切换工人版';
			} else {
				this.toggleContent = '切换企业版';
			}
			this.loadData();
			// 停止下拉刷新
			setTimeout(function() {
				uni.stopPullDownRefresh()
			}, 500)

		},
		onLoad() {
			//判断是否登录
			// let result = this.$api.isLogin();
			// if (result === false) {
			// 	return false;
			// }

			// #ifdef APP-PLUS
			if (uni.getSystemInfoSync().platform == 'ios') {
				this.isShowRecharge = false;
			}
			// #endif

			uni.showLoading({
				title: '加载中...'
			});

			if (this.hasLogin) {
				this.loadData();
			}

			let cate = uni.getStorageSync('cate');
			if ([1, 2].indexOf(cate) > -1) {
				this.cate = cate
			}

			if (this.cate == 2) {
				this.toggleContent = '切换工人版';
				uni.setStorageSync('uploadType', 'logo')
			} else {
				this.toggleContent = '切换企业版';
				this.borderRadius = "50%"
				uni.setStorageSync('uploadType', 'headimg')
			}

			setTimeout(() => {
				this.isLoaded = true;
				uni.hideLoading();
			}, 600)

			uni.$on('changeRealname', (option) => {
				this.userInfo.name = option.realname;
			})

			uni.$on('changeStatus', () => {
				this.loadData();
			})

			if (this.cate == 2) {
				uni.$on('changeLogo', (option) => {
					let data = JSON.parse(option)
					this.userInfo.logo = data.data;
					this.logo(data.data)
				})
			} else {
				uni.$on('changeHeadimg', (option) => {
					let data = JSON.parse(option)
					// console.log(data)
					this.userInfo.headimg = data.data;
					this.headimg(data.data)
				})
			}
		},
		methods: {
			...mapMutations(['login']),

			async loadData() {
				let token = uni.getStorageSync('token');
				// console.log(token)
				let cate = uni.getStorageSync('cate');
				this.cate = cate;

				if (!token) {
					this.$api.msg('token缺失！');
				}
				let url = '/getUserInfo';
				if (cate == 2) {
					url = '/getComInfo';
				}
				let res = await this.$myRequest({
					url: url,
					data: {
						cate: cate,
						token: token
					},
					methods: 'post'
				})
				this.userInfo = res.data.data
				let info = res.data.data;
				uni.setStorageSync("userInfo", info)
				if (cate == 1) {
					if (info.realname) {
						this.userInfo.name = info.realname;
					}
					if (info.avatar) {
						this.userInfo.headimg = info.avatar;
					} else {
						this.userInfo.headimg = '/static/images/touxiang.png';
					}

					if (info.resume_status) {
						this.userInfo.status = info.resume_status;
					}

					if (info.wechatid) {
						this.userInfo.wechatid = info.wechatid;
					}

					if (info.broswer_num > 0) {
						this.userInfo.broswer_num = info.broswer_num;
					}

					if (info.appoint_num > 0) {
						this.userInfo.appoint_num = info.appoint_num;
					}

					this.IDcard = {
						ID1: info.ID1 ? info.ID1 : '/static/images/zhengmian.png',
						ID2: info.ID2 ? info.ID2 : '/static/images/fanmian.png',
					}
				} else if (cate == 2) {
					if (info.company_name) {
						this.userInfo.name = info.company_name;
					}
					if (info.logo) {
						this.userInfo.logo = info.logo;
					} else {
						this.userInfo.logo = '/static/images/company_logo.png';
					}

					if (info.status) {
						this.userInfo.status = info.status;
					}

					if (info.wechatid) {
						this.userInfo.wechatid = info.wechatid;
					}

					if (info.appoint_num > 0) {
						this.userInfo.appoint_num = info.appoint_num;
					}

					this.IDcard = {
						ID1: info.ID1 ? info.ID1 : '/static/images/zhengmian.png',
						ID2: info.ID2 ? info.ID2 : '/static/images/fanmian.png',
					}

					if (info.license) {
						this.license = info.license;
					} else {
						this.license = '/pages6/static/images/shangchuanyingyezhizhao.png';
					}

				}
			},

			async checkLogin() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				} else {
					return true;
				}
			},
			//找工程
			findProject(type, title) {
				//判断是否登录
				if (type == 3) {
					let result = this.$api.isLogin();
					if (result === false) {
						return false;
					}
				}

				uni.navigateTo({
					url: '/pages1/pages/projects/projects?title=' + title + '&type=' + type
				})
			},
			//找劳务
			findWorder(type, title) {
				//判断是否登录
				if (type == 3) {
					let result = this.$api.isLogin();
					if (result === false) {
						return false;
					}
				}

				uni.navigateTo({
					url: '/pages3/pages/workers/workers?title=' + title + '&type=' + type
				})
			},
			async authApply() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				// console.log(this.userInfo)
				if (this.cate == 1) {
					let status = this.userInfo.resume_status;
					switch (status) {
						case 0:
							this.$api.msg('请先完成基本信息')
							setTimeout(() => {
								uni.navigateTo({
									url: '/pages2/pages/personal/personal'
								})
							}, 600)
							break;
						case 1:
							this.$api.msg('请先完成工作信息')
							setTimeout(() => {
								uni.navigateTo({
									url: '/pages2/pages/work/work'
								})
							}, 600)
							break;
						case 2:
							uni.navigateTo({
								url: "/pages2/pages/authentication/authentication?ID1=" + encodeURI(this.IDcard
										.ID1) +
									"&ID2=" + encodeURI(this.IDcard.ID2)
							})
							break;
						case 3:
							this.$api.msg('正在审核中，请耐心等待')
							break;
						case 4:
							this.$api.msg('已通过认证，无需再次认证')
							break;
						case -1:
							uni.navigateTo({
								url: "/pages2/pages/authentication/authentication"
							})
							break;
					}
				} else if (this.cate == 2) {
					let status = this.userInfo.status;
					switch (status) {
						case -1:
							uni.navigateTo({
								url: "/pages4/pages/company-authentication/company-authentication"
							})
							break;
						case 0:
							this.$api.msg('请先完成基本信息')
							setTimeout(() => {
								uni.navigateTo({
									url: '/pages4/pages/company/company'
								})
							}, 600)
							break;

						case 1:
							uni.navigateTo({
								url: "/pages4/pages/company-authentication/company-authentication?ID1=" +
									encodeURI(
										this.IDcard.ID1) +
									"&ID2=" + encodeURI(this.IDcard.ID2) + "&license=" + encodeURI(this
										.license)
							})
							break;
						case 2:
							this.$api.msg('正在审核中，请耐心等待')
							break;
						case 3:
							this.$api.msg('已通过认证，无需再次认证')
							break;

					}
				}

			},

			//考勤管理
			async timeCard() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}
				uni.navigateTo({
					url: '/pages6/pages/time-card/time-card'
				})
			},
			//我的财富
			async goWealth() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}
				if (uni.getStorageSync("userInfo")) {
					if (uni.getStorageSync("userInfo").wealth_status == 0) {
						uni.navigateTo({
							url: '/pages6/pages/wealth/apply'
						})
					} else if (uni.getStorageSync("userInfo").wealth_status == 1) {
						this.$api.msg('申请中，等待审核资料！', 'none');
					} else if (uni.getStorageSync("userInfo").wealth_status == 2) {
						uni.navigateTo({
							url: '/pages6/pages/wealth/wealth'
						})
					} else if (uni.getStorageSync("userInfo").wealth_status == 3) {
						uni.navigateTo({
							url: '/pages6/pages/wealth/wealth'
						})
					}
				} else {
					uni.navigateTo({
						url: '/pages6/pages/wealth/apply'
					})
				}
			},

			async setInfo() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				let url = '/pages2/pages/set/set';
				if (this.cate == 2) {
					url = '/pages4/pages/company-set/company-set';
				}
				uni.navigateTo({
					url: url
				})
			},

			async userOrders(status, title) {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				let url = '/pages2_1/pages/user-orders/user-orders?status=' + encodeURI(status) + '&title=' +
					encodeURI(
						title);
				if (this.cate == 2) {
					url = '/pages4/pages/company-orders/company-orders?status=' + encodeURI(status) + '&title=' +
						encodeURI(
							title);
				}
				uni.navigateTo({
					url: url
				})
			},

			async interview() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				let url = "/pages2/pages/interview/interview"
				if (this.cate == 2) {
					url = "/pages4/pages/company-interview/company-interview"
				}

				uni.navigateTo({
					url: url
				})

			},

			async send() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				let url = "/pages2/pages/send/send"
				if (this.cate == 2) {
					url = "/pages4/pages/company-send/company-send"
				}

				uni.navigateTo({
					url: url
				})
			},

			//浏览记录
			async goBroswer() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				let url = '/pages2_1/pages/broswer/broswer-jobs'
				if (this.cate == 2) {
					url = "/pages4/pages/broswer/browse-worker"
				}
				uni.navigateTo({
					url: url
				})
			},

			//我的收藏
			async collect() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				let url = '/pages2_1/pages/collect/collect'
				if (this.cate == 2) {
					url = "/pages4/pages/company-collect/company-collect"
				}
				uni.navigateTo({
					url: url
				})
			},

			//我的余额
			async gomoney() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				uni.navigateTo({
					url: '/pages2/pages/my-money/my-money'
				})
			},

			async goAppoint() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				let url = '/pages2_1/pages/appointment/appointment'
				if (this.cate == 2) {
					url = "/pages4/pages/appointment/company-appointment"
				}
				uni.navigateTo({
					url: url
				})
			},

			async goPublish() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				uni.navigateTo({
					url: '/pages4/pages/publish-manage/publish-manage'
				})
			},

			async goopinion() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				uni.navigateTo({
					url: '/pages/opinion/opinion'
				})
			},

			//邀请
			async invate() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				this.isShowKefu = false;
				// #ifdef APP-PLUS

				if (uni.getSystemInfoSync().platform == 'ios') {
					if (plus.runtime.isApplicationExist({
							pname: 'com.tencent.mm',
							action: 'weixin://'
						})) {

					} else {
						this.$api.msg('尚未安装微信，暂时不可分享！');
						return false;
					}
				}

				this.isShowShare = true;
				// #endif

				// #ifdef H5
				if (this.$wechat && this.$wechat.isWechat()) {
					let locationHref = {
						url: window.location.href
					};

					let res = await this.$myRequest({
						url: '/getWxInfo',
						data: locationHref
					})

					if (res.data.status) {
						var jweixin = this.$wx

						jweixin.config({
							debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
							appId: res.data.data.appId, // 必填，公众号的唯一标识
							timestamp: res.data.data.timestamp, // 必填，生成签名的时间戳
							nonceStr: res.data.data.nonceStr, // 必填，生成签名的随机串
							signature: res.data.data.signature, // 必填，签名，见微信开发文档附录1
							jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData']
						});
						jweixin.ready(() => {
							// config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
							//分享至微信好友
							jweixin.updateAppMessageShareData({
								title: "好友分享", // 分享标题
								desc: "好友分享", // 分享描述
								link: this.webUrl +
									"pages6/pages/my/my", // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
								imgUrl: "https://liande.oss-cn-beijing.aliyuncs.com/pictures/jinjizhaoren.png", // 分享图标
								type: '', // 分享类型,music、video或link，不填默认为link
								dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
								success: function() {
									// 用户点击了分享后执行的回调函数
									// console.log('分享给好友');

								}
							});
							//分享朋友圈
							jweixin.updateTimelineShareData({
								title: "好友分享", // 分享标题
								link: this.webUrl + "pages6/pages/my/my", // 分享链接
								imgUrl: "https://liande.oss-cn-beijing.aliyuncs.com/pictures/jinjizhaoren.png", // 分享图标
								success: function() {
									// 用户确认分享后执行的回调函数
									// console.log('分享到朋友圈');
								},

							});

						});
						jweixin.error(function(res) {
							// config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
							console.log('验证失败');
							console.log(res);
						});

						this.$refs.alertDialog2.open()
					}
				} else {
					this.$refs.alertDialog1.open()
				}
				// #endif
			},

			//浏览器中下载app
			async dialogConfirm1() {
				window.location.href = "https://test.hnliandesy.com/loading.html"
			},

			async contract() {
				if (!this.hasLogin) {
					this.$api.msg('请先登录！', 'none');
					setTimeout(() => {
						uni.navigateTo({
							url: '/pages/login/login',
						})
					}, 1000)
					return false;
				}

				this.$api.msg('正在开发中！')
			},

			async helpCenter() {
				uni.navigateTo({
					url: '/pages6/pages/help-center/help-center'
				})
			},

			//取消
			async cancle(type) {
				switch (type) {
					case 1:
						this.isShowKefu = false;
						break;
					case 2:
						this.isShowShare = false;
						break;
				}
			},

			async haoyou() {
				uni.share({
					provider: "weixin",
					scene: "WXSceneSession",
					type: 0,
					href: this.webUrl + "pages6/pages/my/my",
					title: "好友分享",
					summary: "好友分享",
					imageUrl: "https://liande.oss-cn-beijing.aliyuncs.com/pictures/jinjizhaoren.png",
					success: (res) => {
						this.$api.msg('分享成功', 'success');
					},
					fail: (err) => {
						this.$api.msg(JSON.stringify(err));
					}
				});
			},

			async pengyouquan() {
				uni.share({
					provider: "weixin",
					scene: "WXSenceTimeline",
					type: 0,
					href: this.webUrl + "pages6/pages/my/my",
					title: "好友分享",
					summary: "好友分享",
					imageUrl: "https://liande.oss-cn-beijing.aliyuncs.com/pictures/jinjizhaoren.png",
					success: (res) => {
						this.$api.msg('分享成功', 'success');
					},
					fail: (err) => {
						this.$api.msg(JSON.stringify(err));
					}
				});
			},

			async copyUrl() {
				uni.setClipboardData({
					//准备复制的数据
					data: this.webUrl + "pages6/pages/my/my",
					success: (res) => {
						this.$api.msg('复制成功！')
					}
				})
			},

			//我的客服
			async kefu() {
				this.isShowKefu = true;
				this.isShowShare = false;
			},

			async callPhone() {
				uni.makePhoneCall({
					phoneNumber: '0371-63213817'
				});
			},

			async headimg(headimg) {
				// console.log(headimg)
				let token = uni.getStorageSync('token');
				let res = await this.$myRequest({
					url: '/headimg',
					data: {
						cate: 1,
						token: token,
						headimg: headimg
					},
					methods: 'post'
				})
			},

			async logo(logo) {
				let token = uni.getStorageSync('token');
				let res = await this.$myRequest({
					url: '/logo',
					data: {
						cate: 2,
						token: token,
						logo: logo
					},
					methods: 'post'
				})
			},

			async confirmToggle() {

				let ncate = 1;
				let tc = '切换企业版';
				if (this.cate == 1) {
					ncate = 2;
					tc = '切换工人版';
				}

				if (!this.hasLogin) {
					this.cate = ncate;
					uni.setStorageSync('cate', ncate);
					this.toggleContent = tc;
					return;
				}

				let token = uni.getStorageSync('token');

				let url = '/switch_account';
				let res = await this.$myRequest({
					url: url,
					data: {
						cate: this.cate,
						token: token
					},
					methods: 'post'
				})

				this.login(res.data.data.data);

				this.cate = ncate;
				uni.setStorageSync('token', res.data.data.token);
				uni.setStorageSync('cate', ncate);
				this.toggleContent = tc;

				setTimeout(function() {
					uni.reLaunch({
						url: '/pages6/pages/my/my'
					})
				}, 1000)
			},

			async goVip() {
				uni.navigateTo({
					url: '/pages6/pages/my/user-vip'
				})
			}
		},
	}
</script>

<style>
	page {
		background-color: #f7f7f7;
		font-size: $font-base;
		height: 1420upx;
	}
</style>

<style lang="scss" scoped>
	/* 头部 */
	.carousel-section {
		position: relative;
		// #ifdef H5
		height: 410rpx;
		// #endif
		// #ifndef H5
		height: 510rpx;
		// #endif

		background-image: url('@/pages6/static/images/back3.png');
		background-size: 100% 100%;
		// #ifdef H5
		padding-top: 34upx;
		// #endif
		// #ifndef H5
		padding-top: 134upx;
		// #endif

		position: relative;

		.navbar {
			display: flex;
			align-items: center;

			.navbar_img {
				width: 109rpx;
				height: 109rpx;
				margin-right: 28rpx;
				margin-left: 25rpx;

			}

			.navbar_text {
				height: 96rpx;
				display: flex;
				flex-direction: column;
				align-items: left;
				color: #fff;

				.navbar_text-name {
					height: 45rpx;
					line-height: 45rpx;
					font-size: $font-lg;
					/* font-weight: bold; */
					margin-bottom: 14rpx;
				}

				.navbar_text-level {
					height: 38rpx;
					line-height: 38rpx;
					display: flex;
					justify-content: left;

					.navbar_text-level-img {
						height: 38rpx;
						width: 97rpx;
						display: inline-block;
						margin-right: 10rpx;
					}

					.navbar_text-level-text {
						font-size: 24rpx;
					}
				}
			}

		}

		.navbar_url {
			position: absolute;
			// #ifdef H5
			top: 210upx;
			// #endif
			// #ifndef H5
			top: 286upx;
			// #endif

			padding: 0 42upx;
			color: #fff;
			height: 86rpx;
			display: flex;
			justify-content: space-between;
			width: 100%;
			// background-color: rgba($color: #000000, $alpha: .2);

			.navbar_url_first,
			.navbar_url_second,
			.navbar_url_third {
				width: 33.3%;
				// #ifdef MP-WEIXIN
				width: 50%;
				// #endif
				text-align: center;

				display: flex;
				flex-direction: column;
				align-items: center;
				// padding: 10rpx 0;
				font-size: $font-base;
				position: relative;
			}

			.navbar_url_first_img,
			.navbar_url_second_img,
			.navbar_url_third_img {
				width: 30rpx;
				height: 32rpx;
				// margin-bottom: 8rpx;
				position: absolute;
				// top: 13rpx;
			}

			.navbar_url_first_text,
			.navbar_url_second_text,
			.navbar_url_third_text {
				position: absolute;
				bottom: 0upx;
			}

			.navbar_url_first,
			.navbar_url_second {
				// border-right: 1px solid #bf634f;
			}
		}
	}

	/* 快捷方式 */
	.cate-section {
		background: #fff;
		width: 700upx;
		height: 250rpx;
		margin-left: 25upx;
		border-bottom-left-radius: 20upx;
		border-bottom-right-radius: 20upx;

		.cate-section-header {
			height: 92rpx;
			padding: 0 32rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.cate-section-header-left {
				display: flex;
				align-items: center;
			}

			.cate-section-header-left-img {
				width: 6rpx;
				height: 27rpx;
				margin-right: 16rpx;
			}

			.cate-section-header-left-text {
				/* font-weight: bold; */
				font-size: $font-base;
			}

			.cate-section-header-right-text {
				font-size: $font-base;
				color: $font-color-dark;
				margin-right: 18rpx;
			}

			.cate-section-header-right-img {
				width: 9rpx;
				height: 18rpx;
			}
		}

		.cate-section-content {
			height: 140rpx;
			display: flex;
			justify-content: space-around;
			align-items: center;
			flex-wrap: wrap;
			// border-top: 1px solid #ececec;
			// border-bottom: 1px solid #ececec;

			.cate-item {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				font-size: $font-sm;
				color: $font-color-dark;
				// border-right: 1px solid #ececec;
				width: 33.3%;

				.cate-item-img {
					width: 80upx;
					height: 80upx;
					margin-bottom: 14rpx;
				}

				.cate-item-text {
					font-size: $font-base;
				}
			}
		}
	}

	.members {
		height: 100upx;
		width: 700upx;
		margin: 0 25rpx;
		position: absolute;
		bottom: 0;
		background-image: url('@/pages6/static/images/member.png');
		background-size: 100%;
	}

	.members-btn {
		width: 135upx;
		height: 52upx;
		background-color: #ffe8ab;
		border-radius: 26upx;
		font-size: 26upx;
		display: flex;
		align-items: center;
		justify-content: center;
		position: absolute;
		right: 20upx;
		bottom: 30upx;
	}

	.place {
		height: 25upx;
	}

	.list {
		height: 618upx;
		background-color: #fff;
		width: 700upx;
		margin-left: 25rpx;
		border-radius: 20upx;
		padding-top: 32upx;

		.list-header {
			padding-left: 32upx;
			display: flex;
			align-items: center;
			// border-bottom: 1px solid #ececec;

			.list-header-img {
				width: 6rpx;
				height: 27rpx;
				margin-right: 16rpx;
			}

			.list-header-text {
				/* font-weight: bold; */
				font-size: $font-base;
			}
		}

		.list-item {
			display: flex;
			height: 158upx;
			width: 25%;
			float: left;
			flex-direction: column;
			align-items: center;
			// justify-content: center;
			padding-top: 32upx;

			.list-item-img {
				height: 80rpx;
				width: 80rpx;
				margin-bottom: 6rpx;
			}

			.list-item-text {
				display: flex;
				flex-direction: column;
				align-items: left;
				// padding: 6rpx 0;

				.list-item-text-title {
					font-size: $font-base;
					// font-weight: bold;
				}

				// .list-item-text-introduct {
				// 	color: #d0d0d0;
				// 	font-size: 24rpx;
				// }
			}
		}
	}

	.mark1 {
		z-index: 100;
		position: fixed;
		height: 100%;
		width: 100%;
		top: 0rpx;
		bottom: 0rpx;
		background: rgba(0, 0, 0, 0.5);
		box-shadow: 2px -3px 100px -5px #FFFFFF;

		.banks-list {
			position: fixed;
			height: 340rpx;
			bottom: 0rpx;
			background-color: #fff;
			width: 100%;

			.banks-list-title {
				height: 88rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				border-bottom: 1px solid #ebebeb;
				position: relative;
			}

			.banks-list1 {
				padding-top: 80rpx;
				height: 230rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				margin: 0 66rpx;

				.banks-list1-center {
					display: flex;
					flex-direction: column;
					align-items: left;

					.text1 {
						/* font-weight: bold; */
						line-height: 50rpx;
					}

					.text2 {
						color: #959595;
						font-size: 26rpx;
					}
				}
			}

			.banks-list-button {
				padding-top: 20rpx;
				display: flex;
				justify-content: center;
			}
		}
	}

	.mark2 {
		z-index: 100;
		position: fixed;
		height: 100%;
		width: 100%;
		top: 0rpx;
		bottom: 0rpx;
		background: rgba(0, 0, 0, 0.5);
		box-shadow: 2px -3px 100px -5px #FFFFFF;
		font-size: $font-base;

		.banks-list {
			position: absolute;
			height: 496rpx;
			bottom: 0rpx;
			background-color: #fff;
			width: 100%;

			.banks-list-title {
				height: 88rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				border-bottom: 1px solid #ebebeb;
				position: relative;
			}

			.banks-list-content {
				.banks-list1 {
					height: 230rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;

					margin: 0 66rpx;

					.banks-list1-item {
						width: 33.3%;
						display: flex;
						flex-direction: column;
						align-items: center;
					}
				}

				.banks-list2 {
					position: relative;
					height: 176rpx;
					border-top: 1px solid #f3f3f6;

					.banks-list2-cancle {
						position: absolute;
						margin: auto;
						top: 0;
						left: 0;
						bottom: 0;
						right: 0;

						width: 80%;
						background-color: #f2451a;
						color: #fff;
						height: 82rpx;
						border-radius: 82rpx;
						display: flex;
						align-items: center;
						justify-content: center;
					}
				}

			}

			.banks-list-button {
				padding-top: 20rpx;
				display: flex;
				justify-content: center;
			}

			.images {
				width: 102rpx;
				height: 102rpx;
			}

			.texts {
				margin-top: 20rpx;
				color: #737373
			}

		}
	}

	.today-num {
		position: absolute;
		padding: 4rpx;
		background-color: $base-color;
		color: #fff;
		border-radius: 10rpx;
		font-size: 20rpx;
		left: 100rpx;
		top: 24rpx;
		min-width: 38rpx;
		text-align: center;
	}

	.toggle {
		margin-top: 40upx;
		display: flex;
		justify-content: center;
	}

	.toggle-info {
		width: 80%;
		background-color: #F3431A;
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		height: 88upx;
		border-radius: 15upx;
		font-size: 30upx;
		letter-spacing: 4upx;
	}
</style>